package com.xqq.entity;

import lombok.Data;

import java.util.List;

@Data
public class UavData {
    private RTKInfo RTKInfo;
    private String UAVID;
    private AttitudeInfo attitudeInfo;
    private List<Battery> batteries;
    private String brand;
    private List<Camera> cameras;
    private FlightControllerInfo flightControllerInfo;
    private List<Gimbal> gimbals;
    private boolean isUAVOnline;
    private MissionInfo missionInfo;
    private RcPosition rcPosition;
    private int state;
    private int subState;
    private long timestamp;
    private UavInfo uavInfo;
    private String msgFrom;
}

@Data
class RTKInfo {
    private int RTKState;
}

@Data
class AttitudeInfo {
    private double altitude = -0.10039520263671875;
    private double hspeed = 0;
    private double latitude;
    private double longitude;
    private double pitch = 0;
    private double roll = 0;
    private double takeoffAltitude = 100.14461517333984;
    private double vspeed = -0.0000000000000000000000000000000024918577405952102;
    private double yaw = 0;
}

@Data
class Battery {
    private int chargeRemaining;
    private int chargeRemainingInPercent;
    private String connectionState;
    private int current;
    private int designCapacity;
    private int fullChargeCapacity;
    private String lifetimeRemaining;
    private String numberOfDischarges;
    private String serialNumber;
    private int temperature;
    private int voltage;
}

@Data
class Camera {
    private int cameraMode = 1;
    private String cameraType = "ZENMUSE_H20";
    private int isRecording = 0;
    private int opticalZoomFocalLength = 0;
    private int sdAvailableCaptureCount = 0;
    private int sdAvailableRecordingTime = 0;
    private int sdRemainingSpaceInMB = 0;
    private int sdTotalSpaceInMB = 0;
    private int videoSourceType = 2;
    private int zoomMultiple = 0;
}

@Data
class FlightControllerInfo {
    private int downlink = 0;
    private List<List<ErrorInfo>> errorInfos;
    private int gpsCount = 0;
    private int gpsLevel = 5;
    private int isCompassError = 0;
    private int isFlying = 0;
    private int isGoingHome = 0;
    private int isMotorOn = 0;
    private int uplink = 0;
    private int windSpeed = 0;
}

@Data
class ErrorInfo {
    private String code;
    private String reason;
    private String solution;
}

@Data
class Gimbal {
    private double pitch = 0;
    private double roll = 64.300003051757812;
    private double yaw = 0;
    private int yawFollowEnabled = 1;
}

@Data
class MissionInfo {
    private String hiveID = "";
    private double launchLatitude;
    private double launchLongitude;
    private String missionBatch = "123e4567-e89b-12d3-a456-426614174000";
    private String rthsHiveID = "";
    private int wayPointIndex = 0;
    private String wayPointMissionExecuteState = "";
    private int wayPointTotal = 3;
}

@Data
class RcPosition {
    private String rcLatitude = "32.416385";
    private String rcLongitude = "120.54792433333333";
}

@Data
class UavInfo {
    private String uavModel;
    private String uavSN;

    public UavInfo(String uavModel, String uavSN) {
        this.uavModel = uavModel;
        this.uavSN = uavSN;
    }
}
